﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using WebSite.Models;

namespace WebSite.Controllers
{
    public class NavigatorController : HWBaseController
    {
        [ChildActionOnly]
        public ActionResult MainMenu()
        {
            List<MenuItemVM> items = new List<MenuItemVM>
            {
                //new MenuItemVM{Text="ГЛАВНАЯ",Action="Index",Controller="Home",Selected=false},
                new MenuItemVM{Text="ОБУЧЕНИЕ",Action="Index",Controller="Training",Selected=false},
                new MenuItemVM{Text="СОТРУДНИЧЕСТВО",Action="Index",Controller="Collaboration",Selected=false},
                new MenuItemVM{Text="ТРУДОУСТРОЙСТВО",Action="Index",Controller="Placement",Selected=false},
                //new MenuItemVM{Text="РАСПИСАНИЕ",Action="Index",Controller="Schedule",Selected=false},
                //new MenuItemVM{Text="ЗАПИСЬ НА КУРС",Action="Signup",Controller="Contact",Selected=false},
                new MenuItemVM{Text="КОНТАКТЫ",Action="Index",Controller="Contact",Selected=false}
                /*new MenuItemVM{Text="БЛОГ",ExternalLink=  System.Configuration.ConfigurationManager.AppSettings["BlogLink"],Selected=false},
                new MenuItemVM{Text="О НАС",Action="Index",Controller="About",Selected=false},*/
            };
            

            if (this.User.Identity.IsAuthenticated)
            {
                items.Add(new MenuItemVM { Text = "УГОЛОК СТУДЕНТА", Action = "Index", Controller = "Student", Selected = false });
                items.Add(new MenuItemVM { Text = "А", Action = "Index", Controller = "Admin", Selected = false });
            }
            else
            {
                items.Add(new MenuItemVM{Text="УГОЛОК СТУДЕНТА",Action="Index",Controller="Student",Selected=false});
            }

            String action     = ControllerContext.ParentActionViewContext.RouteData.Values["action"].ToString();
            String controller = ControllerContext.ParentActionViewContext.RouteData.Values["controller"].ToString();

            foreach (MenuItemVM item in items)
            {
                if (item.Controller == controller /*&& item.Action == action*/)
                {
                    item.Selected = true;
                }
            }
            return PartialView(items);
        }
    }
}
